package com.ehsy.service;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.callback.OnError;
import com.dtflys.forest.http.ForestResponse;
import com.ehsy.common.ResponseVo;
import com.ehsy.config.MySuccessCondition1;
import com.ehsy.config.MySuccessCondition2;
import com.ehsy.model.UserInfo;
import org.springframework.stereotype.Component;

/**
 * @author YanZhen_Li
 * @version 1.0
 * @title SuccessfulCodeService
 * @description
 * @create 2024/6/18 17:00
 */
@Component
@Address(host = "127.0.0.1", port = "8080")
public interface SuccessfulCodeService {
    /**
     * 全局配置，200成功
     */
    @Get("/test/code/{code}")
    String test01(@Var("code") Integer code);

    /**
     * 单独配置，600以下成功
     */
    @Get("/test/code/{code}")
    @Success(condition = MySuccessCondition2.class)
    String test02(@Var("code") Integer code);

    /**
     * 全局配置2测试
     */
    @Get("/test/request/json/body")
    ResponseVo<UserInfo> test03(@Query UserInfo user);


    @Get("/test/code/{code}")
    String test04(@Var("code") Integer code, OnError onError);

    @Get("/test/code/{code}")
    ForestResponse<String> test05(@Var("code") Integer code);
}
